package Demo;

import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

public class Main {
    public static void main(String[] args) {

        CardDemo cardDemo=new CardDemo();

          List<Card> L= cardDemo.buyDeck();
        Iterator Ic=L.iterator();//迭代器
        while(Ic.hasNext()){

            System.out.print(Ic.next());
        }
        System.out.println(" ");
        System.out.println("=========洗牌===========");

          cardDemo.shuffle(L);//洗牌

        ListIterator<Card> Ic2=L.listIterator();
        ListIterator<Card> Ic3=L.listIterator(L.size()-1);

        while (Ic3.hasPrevious()){

            System.out.print(Ic3.previous());
        }

     /*   while(Ic2.hasNext()){
            System.out.print(Ic2.next());
        }
        System.out.println();*/
        System.out.println();

        int i=L.size();
        System.out.println(i);

          List<List<Card>> c=  cardDemo.SetCard(L);

          ListIterator<List<Card>> iterator= c.listIterator();
          while (iterator.hasNext()){
              System.out.println(iterator.next());
          }

    }
}
